<template>
	<view>
		<button @click="callPullRef()">下拉刷新</button>
		<view v-for="index in count">
			<view style="height: 100rpx;background-color: aquamarine; margin: 5rpx;">测试数据{{index}}</view>
		</view>
		<view style="color:#aaa; text-align: center;margin: 30rpx; height: 60rpx;"> ---真的到底了---</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				count: 30
			}
		},
		onPullDownRefresh() {
			console.log("onPullDownRefresh-->  触发 下拉刷新开始");
			setTimeout(function() {
				uni.stopPullDownRefresh();
				console.log("onPullDownRefresh--> End下拉刷新动作完成");
			}, 2000);
		},
		onReachBottom() {
			console.log("onReachBottom---> 我已经到底了，请求加载更多数据吧" + this.count);
			if (this.count < 200)
				this.count = this.count + 30;
		},
		methods: {
			callPullRef() {
				console.log("下拉自动刷新 callPullRef");
				uni.startPullDownRefresh({
					success() {
						console.log("startPullDownRefresh success");
					},
					fail() {
						console.log("startPullDownRefresh fail");
					},
					complete() {
						console.log("startPullDownRefresh complete");
					}
				})
			}
		}
	}
</script>

<style>
	button {
		margin: 30rpx;
	}
</style>